package question3;


public class Factoriel extends Unaire{ // a completer 
	
     public Factoriel(Expression expression){
    	 super(expression);
     }
	 
	 public String toString(){
	   return getExpression().toString() + "!"; 
	 }
	 
	 public int interprete(Contexte c){
	   return fact(getExpression().interprete(c)); // a completer
	 }
	 
	 private static Integer fact(int n){
	   if(n==0) return 1;
	   else return n*(fact(n-1));
	 }

}
